/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ceha;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Gilles
 */
@Entity
@Table(name = "membre", catalog = "ceha", schema = "")
@NamedQueries({
    @NamedQuery(name = "Membre.findAll", query = "SELECT m FROM Membre m"),
    @NamedQuery(name = "Membre.findById", query = "SELECT m FROM Membre m WHERE m.id = :id"),
    @NamedQuery(name = "Membre.findByPseudo", query = "SELECT m FROM Membre m WHERE m.pseudo = :pseudo"),
    @NamedQuery(name = "Membre.findByPass", query = "SELECT m FROM Membre m WHERE m.pass = :pass"),
    @NamedQuery(name = "Membre.findByNom", query = "SELECT m FROM Membre m WHERE m.nom = :nom"),
    @NamedQuery(name = "Membre.findByPrenom", query = "SELECT m FROM Membre m WHERE m.prenom = :prenom"),
    @NamedQuery(name = "Membre.findByInitiale", query = "SELECT m FROM Membre m WHERE m.initiale = :initiale"),
    @NamedQuery(name = "Membre.findByRole", query = "SELECT m FROM Membre m WHERE m.role = :role"),
    @NamedQuery(name = "Membre.findByConsult", query = "SELECT m FROM Membre m WHERE m.consult = :consult"),
    @NamedQuery(name = "Membre.findByIndexation", query = "SELECT m FROM Membre m WHERE m.indexation = :indexation"),
    @NamedQuery(name = "Membre.findByValidation", query = "SELECT m FROM Membre m WHERE m.validation = :validation"),
    @NamedQuery(name = "Membre.findByAdminist", query = "SELECT m FROM Membre m WHERE m.administ = :administ")})
public class Membre implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Short id;
    @Basic(optional = false)
    @Column(name = "pseudo")
    private String pseudo;
    @Basic(optional = false)
    @Column(name = "pass")
    private String pass;
    @Column(name = "nom")
    private String nom;
    @Column(name = "prenom")
    private String prenom;
    @Basic(optional = false)
    @Column(name = "initiale")
    private String initiale;
    @Basic(optional = false)
    @Column(name = "role")
    private String role;
    @Basic(optional = false)
    @Column(name = "consult")
    private boolean consult;
    @Basic(optional = false)
    @Column(name = "indexation")
    private boolean indexation;
    @Basic(optional = false)
    @Column(name = "validation")
    private boolean validation;
    @Basic(optional = false)
    @Column(name = "administ")
    private boolean administ;

    public Membre() {
    }

    public Membre(Short id) {
        this.id = id;
    }

    public Membre(Short id, String pseudo, String pass, String initiale, String role, boolean consult, boolean indexation, boolean validation, boolean administ) {
        this.id = id;
        this.pseudo = pseudo;
        this.pass = pass;
        this.initiale = initiale;
        this.role = role;
        this.consult = consult;
        this.indexation = indexation;
        this.validation = validation;
        this.administ = administ;
    }

    public Short getId() {
        return id;
    }

    public void setId(Short id) {
        Short oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getPseudo() {
        return pseudo;
    }

    public void setPseudo(String pseudo) {
        String oldPseudo = this.pseudo;
        this.pseudo = pseudo;
        changeSupport.firePropertyChange("pseudo", oldPseudo, pseudo);
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        String oldPass = this.pass;
        this.pass = pass;
        changeSupport.firePropertyChange("pass", oldPass, pass);
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        String oldNom = this.nom;
        this.nom = nom;
        changeSupport.firePropertyChange("nom", oldNom, nom);
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        String oldPrenom = this.prenom;
        this.prenom = prenom;
        changeSupport.firePropertyChange("prenom", oldPrenom, prenom);
    }

    public String getInitiale() {
        return initiale;
    }

    public void setInitiale(String initiale) {
        String oldInitiale = this.initiale;
        this.initiale = initiale;
        changeSupport.firePropertyChange("initiale", oldInitiale, initiale);
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        String oldRole = this.role;
        this.role = role;
        changeSupport.firePropertyChange("role", oldRole, role);
    }

    public boolean getConsult() {
        return consult;
    }

    public void setConsult(boolean consult) {
        boolean oldConsult = this.consult;
        this.consult = consult;
        changeSupport.firePropertyChange("consult", oldConsult, consult);
    }

    public boolean getIndexation() {
        return indexation;
    }

    public void setIndexation(boolean indexation) {
        boolean oldIndexation = this.indexation;
        this.indexation = indexation;
        changeSupport.firePropertyChange("indexation", oldIndexation, indexation);
    }

    public boolean getValidation() {
        return validation;
    }

    public void setValidation(boolean validation) {
        boolean oldValidation = this.validation;
        this.validation = validation;
        changeSupport.firePropertyChange("validation", oldValidation, validation);
    }

    public boolean getAdminist() {
        return administ;
    }

    public void setAdminist(boolean administ) {
        boolean oldAdminist = this.administ;
        this.administ = administ;
        changeSupport.firePropertyChange("administ", oldAdminist, administ);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Membre)) {
            return false;
        }
        Membre other = (Membre) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ceha.Membre[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
